<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>登录</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
    <style type="text/css">
    	html,body{
    		background-color: white;
    	}
    </style>
</head>

<body>
    <div class="mui-content login-content">
      <div class="top-color1" >

      </div>
			<div class="top-color">
				<p style=" font-size: 0.8rem;
          color: white;">物料工单管理系统</p>
				<p class="login-tips-text">APP软件</p>
			</div>
			<div class="input-content">
				<form class="mui-input-group">
					<div class="mui-input-row">
						<label><i class="mui-icon aui-icon-my"></i></label>
						<input type="text" id="userName" placeholder="请输入用户名">
					</div>
					<div class="mui-input-row">
						<label><i class="mui-icon aui-icon-lock"></i></label>
						<input type="password" id="userPass" class="mui-input-clear" placeholder="请输入6-16位密码"><span class="mui-icon mui-icon-clear mui-hidden"></span>
					</div>
					<div class="mui-button-row">
						<button type="button" id="loginBtn" class="login-btn mui-btn mui-btn-primary mui-btn-block">登录</button>
					</div>
				</form>
			</div>
		</div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
		apiready = function() {
			api.parseTapmode();
		}
	$api.addEvt($api.byId('loginBtn'), 'click', function(){
		var user_name = $api.trimAll($api.val($api.byId('userName')));
		var user_pass = $api.trimAll($api.val($api.byId('userPass')));
		if (user_name == '') {
			$api.toast('请输入用户名！');
			return;
		}
		if (user_pass == '') {
			$api.toast('请输入密码！');
			return;
		}
		ajaxrd("appLogin", {
				loginid: user_name,
				pwd: user_pass
		}, function(ret, err) {
			$api.setStorage('partsInfo', {
				'token' : ret.token,
				'userName': ret.userName,
				'loginId' : ret.loginId
			});
			api.sendEvent({
                name: 'refersh',
                extra: {
                    isrefersh: 'yes',
                    token: ret.token
                }
           });
			setTimeout(function(){
				$api.val($api.byId('userName'),'');
				$api.val($api.byId('userPass'),'');
				api.closeWin();
				api.openTabLayout({
				    name: 'root'
				});
			},500)

		})
	});

</script>

</html>
